using System;
namespace Plain.Search
{
	public class PropertyIdentifierGeneric:PropertyIdentifier
	{
		private Type t ;
		public PropertyIdentifierGeneric (string s, Type t):base(s){
			this.t=t;
		}
		
		public override void CheckType(object o){
			if(t.IsValueType && o == null){
				throw new PropertyTypeMismatch( Name + " can't be compared with NULL");
			}else if(t.IsValueType && !o.GetType().IsValueType){
				throw new PropertyTypeMismatch( Name + " can't be compared with a " + o.GetType().Name);
			}else if(t == typeof(int) && o.GetType() == typeof(long)){
				throw new PropertyTypeMismatch( Name + " is a integer and can't be compared with a long");
				
			}
			
		}
	}
}

